package fr.emn.integration.synthese.controle;

import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JButton;
import javax.swing.JMenuItem;

import fr.emn.integration.synthese.abstraction.BDCours;
import fr.emn.integration.synthese.abstraction.Cours;
import fr.emn.integration.synthese.abstraction.Eleve;
import fr.emn.integration.synthese.presentation.EleveDialog;
import fr.emn.integration.synthese.presentation.GroupeDialog;
import fr.emn.integration.synthese.presentation.StatisticsDialog;

public class ControlJButtonDistrib implements ActionListener, Observer {

	private Cours modele;
	private ArrayList<Eleve> liste;
	private JButton buton;


	public ControlJButtonDistrib( Cours modele, ArrayList<Eleve> liste, JButton buton) {
		this.modele = modele;
		this.liste=liste;
		this.buton= buton;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		new StatisticsDialog(liste, modele);
	}

	@Override
	public void update(Observable arg0, Object arg1) {
		if (modele.getEvaluationCourante() == -1){
			this.buton.setEnabled(false);
		}
		else{
			this.buton.setEnabled(true);
		}
	}
}
